﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.RenameTool.RulesManager.CUiSaveRuleWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.RenameTool.RulesManager;

public class CUiSaveRuleWindow : TxWindow, INotifyPropertyChanged, IComponentConnector
{
  private string _RuleName = "";
  private string _RuleDescription = "";
  internal Label lbName;
  internal TextBox tbName;
  internal Label lbDescription;
  internal TextBox tbDescription;
  internal Button btnCancel;
  internal Button btnOk;
  private bool _contentLoaded;

  public CUiSaveRuleWindow(Window parent)
  {
    this.InitializeComponent();
    ((Window) this).Owner = parent;
    this.tbName.Focus();
    // ISSUE: explicit non-virtual call
    __nonvirtual (((Window) this).Title) = XamlResourceManager.GetString("RENAME_TOOL_TITLE_SAVESETRULES");
  }

  public string RuleName
  {
    get => this._RuleName;
    set => this._RuleName = value;
  }

  public string RuleDescription
  {
    get => this._RuleDescription;
    set => this._RuleDescription = value;
  }

  public event PropertyChangedEventHandler PropertyChanged;

  private void NotifyPropertyChanged(string propertyName)
  {
    if (this.PropertyChanged == null)
      return;
    this.PropertyChanged((object) this, new PropertyChangedEventArgs(propertyName));
  }

  private void btnOk_Click(object sender, RoutedEventArgs e)
  {
    ((Window) this).DialogResult = new bool?(true);
    this.RuleName = this.tbName.Text;
    this.RuleDescription = this.tbDescription.Text;
    if (this.RuleName.Trim() == "")
      return;
    ((Window) this).Close();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/renametool/rulesmanager/cuisaverulewindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        this.lbName = (Label) target;
        break;
      case 2:
        this.tbName = (TextBox) target;
        break;
      case 3:
        this.lbDescription = (Label) target;
        break;
      case 4:
        this.tbDescription = (TextBox) target;
        break;
      case 5:
        this.btnCancel = (Button) target;
        break;
      case 6:
        this.btnOk = (Button) target;
        this.btnOk.Click += new RoutedEventHandler(this.btnOk_Click);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
